package job.job3;

import java.util.Arrays;

import javax.naming.event.ObjectChangeListener;

public class Rank {
	
	public void sortArr(Object[] arr) {
		System.out.println(Arrays.toString(arr));
		
		System.out.println();
		
		//因为数据类型是Objext需要向下转型 调取具体可以比较大小的数据。
		if (arr instanceof Integer[]) {
			Integer[] array = (Integer[])arr;
			Integer a;
			for (int i = 0; i < array.length; i++) {
				for (int j = 0; j < array.length-i-1; j++) {
					if (array[j] > array[j+1]) {
						a = array[j];
						array[j] = array[j+1];
						array[j+1]=a;
					}
				}
			}
			
		System.out.println(Arrays.toString(arr));
		}
	}
		
	
	
}
